# -*- coding: utf-8 -*-


from xml.etree import cElementTree as ET

from functools import wraps


class WeixinHelper(object):
    def __init__(self):
        pass

    def xmlToArray(self, xml):
        """将xml转为array"""
        array_data = {}
        root = ET.fromstring(xml)
        for child in root:
            value = child.text
            array_data[child.tag] = value
        return array_data

if __name__ == "__main__":
    data = """
            <xml>
            <body>xxxx</body>
            <pa>ooooo<pa>
            </xml>
            """
test = WeixinHelper().xmlToArray(data)
print test